package ys.ewp.junit;

import java.util.Date;
import java.util.List;

import org.junit.Test;

import ys.ewp.po.Column;
import ys.ewp.po.Notice;
import ys.ewp.tool.FormatDate;

public class NoticeTest extends BaseJunit {
	
	@Test
	public void saveNotice(){
		Column c = new Column();
		c.setTitle("项目资讯");
		c.setDateCreated(new Date());
		
		Notice n = new Notice();
		n.setTitle("服务器架构设计初步完成2");
		n.setContent("服务器架构设计初步完成，已经上传google code");
		n.setDateCreated(new Date());
		n.setFormatDateCreated(FormatDate.formatDate(new Date()));
		//n.setColumn(c);
		
		//columnService.save(c);
		for(int i=0;i<10;i++){
			noticeService.save(n);
		}
		//noticeService.save(n);
		
	}
	
	@Test
	public void deleteNotice(){
		noticeService.delete(1);
	}
	
	@Test
	public void getNotice(){
		Notice n = noticeService.getLast();
		System.out.println(n.getTitle());
	}
	
	@Test
	public void getNoticeCount(){
		long count = noticeService.getCount();
		System.out.println(count);
	}
	
	@Test
	public void getNoticesByColId(){
		List<Notice> notices = noticeService.getNoticeListByColId(1);
		System.out.println(notices.size());
	}
	
}
